<?php
  header('content-type: text/html;charset=utf-8;');
//接收前端的参数 
$username = $_POST['user'];
$password = $_POST['pwd'];
// 去数据库验证
$link = mysqli_connect('localhost','root','root','damai');
$sql = " SELECT * FROM  `users` WHERE `user`='$username' AND `pwd`='$password'  ";
$res = mysqli_query($link,$sql);
$row = mysqli_fetch_assoc($res);
mysqli_close($link);

if($row){
  echo json_encode($row);
}
  
?>